<include file="Public/header"/>
<style>
    .checkbox{ display: inline-block;}
    .checkbg{ background: #DBF3DF;text-align: left;color: #777;font-weight: normal;width: 100%;padding:0  0 5px 5px;}
</style>
<div class="wrapper m-t">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <a class="h5 font-bold">编辑功能</a>
        </div>
        <div class="ibox-content">
            <form class="form-horizontal" method="post" action="{:U()}">
                <div class="form-group">
                    <label class="col-sm-2 control-label">岗位</label>
                    <div class="col-sm-6">
                        <input type="text" name="title" value="{$edit.title}" class="form-control">
                    </div>
                </div>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">描述</label>
                    <div class="col-sm-6">
                        <textarea cols="30" rows="5"   name="remark" class="form-control">{$edit.remark}</textarea>
                    </div>

                </div>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>
                    <div class="col-sm-6">
                        <if condition="$edit.status eq 1">
                            <input type="radio" value="1" name="status" checked>启用 &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" value="0" name="status">禁用
                            <else/>
                            <input type="radio" value="1" name="status" >启用 &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" value="0" name="status" checked>禁用
                        </if>

                    </div>

                </div>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">管辖区域</label>
                    <div class="col-sm-6">
                        <select class="form-control" name="area_id">
                            <option  value="">请选择</option>
                            <volist name="areaList" id="vo">
                                <option  value="{$vo.id}"  >{$vo.area_name}</option>
                            </volist>
                        </select>
                    </div>

                </div>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">岗位授权</label>
                    <div class="col-sm-6 ">
                        <span class="m-r checkbox"><input class="check-all"   type="checkbox"/>全选/反选</span>
                        <div class="clearfix"></div>
                    </div>
                </div>

                <volist name="node" id="vo">
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-6">
                            <div class="checkbg">
                                <div class="checkbox">
                                    <label>
                                        <if condition="$vo.check eq 1">
                                            <input class="ids checkids" name="rules[]" value="{$vo.id}" checked type="checkbox"/>
                                            <else/>
                                            <input class="ids checkids" name="rules[]" value="{$vo.id}"  type="checkbox"/>
                                        </if> {$vo.title}
                                    </label>
                                </div>
                            </div>
                        </div>
                        <notempty name="vo['child']">
                            <div class="col-sm-6 col-sm-push-2 m-l-lg" style="margin-left: 45px;">
                                <volist name="vo['child']" id="vs">
                                    <span style="float: left" class="m-r-lg checkbox">
                                        <if condition="$vs.check eq 1">
                                            <input class="ids" name="rules[]" value="{$vs.id}" checked type="checkbox"/>
                                            <else/>
                                            <input class="ids" name="rules[]" value="{$vs.id}"  type="checkbox"/>
                                        </if>{$vs.title}
                                    </span>

                        <notempty name="vs['child']">
                            <div class="col-sm-12" style="margin-left: 15px;">
                                <volist name="vs['child']" id="vc">
                                    <span style="float: left" class="m-r-lg checkbox">
                                          <if condition="$vc.check eq 1">
                                              <input class="ids" name="rules[]" value="{$vc.id}" checked type="checkbox"/>
                                              <else/>
                                              <input class="ids" name="rules[]" value="{$vc.id}"  type="checkbox"/>
                                          </if>{$vc.title}
                                    </span>
                                </volist>
                                <div class="clearfix"></div>
                            </div>
                        </notempty>

                                </volist>
                                <div class="clearfix"></div>
                            </div>
                        </notempty>
                    </div>

                </volist>
                <input type="hidden" name="id" value="{$edit.id}"/>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <div class="col-sm-6 col-sm-offset-2">
                        <button type="submit" class="btn ajax-post  btn-info  col-lg-2 m-r" target-form="form-horizontal">确定</button>
                        <button type="button" onclick="javascript:history.back(-1);return false;" class="btn col-lg-2 btn-primary">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<include file="Public/footer"/>
<script>
    var area_id='{$edit.area_id}';
    $("[name='area_id']").val(area_id);

    $(".checkids").click(function(){
        $(this).parents(".form-group").find(".ids").prop("checked", this.checked);
    })


</script>